import {defineStore} from 'pinia'
import cache from "@/plugins/cache.ts";


// 存储应用程序的位置
const useDefineStore = defineStore('define', {
    state: () => ({
        // 1. 当前正在使用的搜索引擎 key
        useSearchEnginesKey: '',

    }),
    actions: {
        getSearchEngines() {
            if (this.useSearchEnginesKey == '') {
                this.useSearchEnginesKey = cache.local.get("useSearchEngines");
            }
            return this.useSearchEnginesKey || "baidu";
        },
        setSearchEngines(key: string) {
            this.useSearchEnginesKey = key;
            cache.local.set("useSearchEngines", key);
        },
    },
})


export default useDefineStore
